import time

from celery_test.main import app
from meiduo1.libs.yuntongxun.sms import CCP


@app.task(bind=True,name='xixi')
def debug_task(self,mobile,sms_code,time):#这的时间按分钟计算
    try:
        ccp = CCP()
        restu = ccp.send_template_sms(mobile, [sms_code, time],1)
    except Exception as e:
        restu = -1

    if restu == -1:
        print('发送信息失败')
        self.retry(countdown=5,max_retries=3,etc='发送信息失败了')#countdown表示隔得秒数发一次，第二个表示发几次，第三个抛出的异常信息